<template>
    <el-dialog v-model="open" title="持币地址" width="510px">
        <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
            <el-form-item label="HF数量" prop="amount1">
                <el-input v-model="formData.amount1" placeholder="请输入HF数量" />
            </el-form-item>
            <el-form-item label="地址数量" prop="amount2">
                <el-input v-model="formData.amount2" placeholder="请输入地址数量" />
            </el-form-item>
        </el-form>
        <template #footer>
            <span class="dialog-footer">
                <el-button type="primary" :loading="loading" @click="onSubmit('formData')">确定</el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script setup>
import { reactive, ref, defineExpose, defineEmits } from "vue";
import { multiTransfer } from "@/api";
import { ElMessageBox, ElMessage } from "element-plus";
const emit = defineEmits(["onSubmit"]);
const formRef = ref();
const open = ref(false);
const formData = reactive({
    amount1: "",
    amount2: "",
});
const formRules = {
    amount1: [{ required: true, message: "请输入HF数量", trigger: "change" }],
    amount2: [{ required: true, message: "请输入地址数量", trigger: "change" }],
};
const loading = ref(false);
const onSubmit = async () => {
    try {
        const a = await formRef.value.validate().catch(() => null);
        if (!a) return;
        open.value = false;
        const res = await multiTransfer(formData);
        if (res.data.code == 20) {
            ElMessage({
                message: "成功",
                type: "success",
            });
        }
        emit("onSubmit");
    } catch (error) {}
};
const show = (row) => {
    open.value = true;
    formData.amount1 = "";
    formData.amount2 = "";
};
defineExpose({
    show,
});
</script>
<style lang="scss" scoped>
.right {
    overflow: auto;
}

.el-pagination {
    padding: 15px;
    float: right;
}
</style>